package com.wyd.qxglht.service;

import javax.annotation.Resource;

import com.wyd.qxglht.dao.IRolesDao;
import com.wyd.qxglht.dto.RolesDTO;
import com.wyd.qxglht.model.Roles;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
@Service
public class RolesServiceImpl implements IRolesService {

    @Resource
    private IRolesDao rolesDao;

    @Override
    public Page<Roles> findAllPage(RolesDTO dto) {
        // TODO Auto-generated method stub
        Sort sort = Sort.by(Sort.Order.asc("id"));//根据ID排序
        Pageable page = PageRequest.of((dto.getPage() - 1) * dto.getLimit(), dto.getLimit(), sort);
        return rolesDao.findAll(page);
    }

}